package com.utils.buildutil;

import com.bean.Role;
import com.bean.User;
import com.dto.BaseInfoDTO;
import com.utils.ParamUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * @author FatterShadystart
 * @create 2023-02-28 1:17
 */
public class UserBuildUtil {
    public static List<User> buildUserListLogin(User user) {
        List<User> userList = new ArrayList<>();
        userList.add(user);
        return userList;
    }

    public static List<User> buildUserListInsert(User user) {
        List<User> userList = new ArrayList<>();
        userList.add(user);
        return userList;
    }

    public static List<User> buildUserListUpdate(User user) {
        List<User> userList = new ArrayList<>();
        userList.add(user);
        return userList;
    }


    public static List<User> buildUserListByUserIdList(List<Long> userIdList) {

        List<User> userList = new ArrayList<>();
        for (Long userId : userIdList) {
            User user = new User();
            user.setUserId(userId);
            userList.add(user);
        }
        return userList;
    }

    public static List<Role> buildUserListByUserRoleList(Integer size, String userRole) {
        List<Role> roleList = new ArrayList();
        for (int i = 0; i < size; i++) {
            Role roleAdd = new Role();
            roleAdd.setUserRole(userRole);
            roleList.add(roleAdd);
        }
        return roleList;
    }


    public static List<User> buildUserListRegister(User user, BaseInfoDTO baseInfoDTO) {
        List<User> userList = new ArrayList<>();
        //设置baseInfo的信息到user中
        ParamUtil.setBaseInfoNoPage(user, baseInfoDTO);
        userList.add(user);
        return userList;
    }

    public static List<Long> buildUserRoleIdList(Long userRoleId) {
        List<Long> userRoleIdList = new ArrayList<>();
        userRoleIdList.add(userRoleId);
        return userRoleIdList;
    }

    public static List<Role> buildRoleList(String userRole) {
        List<Role> roleList = new ArrayList<>();
        Role role = new Role();
        role.setUserRole(userRole);
        roleList.add(role);
        return roleList;
    }


}
